package com.ch.ms;

import com.ch.ms.server.world.MapleWorldServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@Slf4j
@SpringBootApplication(scanBasePackages = "com.ch")
public class MapleWorldServerApplication implements CommandLineRunner {


    private final MapleWorldServer worldServer;

    @Autowired
    public MapleWorldServerApplication(MapleWorldServer worldServer) {
        this.worldServer = worldServer;
    }

    public static void main(String[] args) {
        SpringApplication.run(MapleWorldServerApplication.class, args);
    }


    @Override
    public void run(String... args) throws Exception {

        worldServer.bind(worldServer.getBindConfiguration().getHost(), worldServer.getBindConfiguration().getPort());
    }


}
